﻿using System.Windows;

namespace MyFloridaHouse.libSvOpenDistricts.PDF
{
    public class HouseMapRectSpecification
    {
        public double originWidthPercent { get; set; }
        public double originHeightPercent { get; set; }
        public double rectWidthPercent { get; set; }
        public double rectHeightPercent { get; set; }

        public HouseMapRectSpecification(double originWidthPercent, double originHeightPercent, double rectWidthPercent, double rectHeightPercent)
        {
            this.originWidthPercent = originWidthPercent;
            this.originHeightPercent = originHeightPercent;
            this.rectWidthPercent = rectWidthPercent;
            this.rectHeightPercent = rectHeightPercent;
        }


        public PDFPoint GetDrawingOrigin(PDFPoint mapBorderOrigin, double mapBorderWidth, double mapBorderHeight)
        {
            PDFPoint drawingCursor = new PDFPoint(mapBorderOrigin);
            drawingCursor.AddX(mapBorderWidth * originWidthPercent);
            drawingCursor.AddY(mapBorderHeight * originHeightPercent);

            return drawingCursor;
        }

        public Rect GetDrawingRect(PDFPoint mapBorderOrigin, double mapBorderWidth, double mapBorderHeight)
        {
            PDFPoint drawingCursor = GetDrawingOrigin(mapBorderOrigin, mapBorderWidth, mapBorderHeight);
            double width = mapBorderWidth * rectWidthPercent;
            double height = mapBorderHeight * rectHeightPercent;

            Rect drawingRect = new Rect(drawingCursor.x, drawingCursor.y, width, height);
            return drawingRect;
        }

    }
}
